
#ifndef __APR_INTERFACE_H
#define __APR_INTERFACE_H

#include <apr_general.h>
#include <apr_errno.h>

/** An interface encapsulating functions to do with the APR
 * library. */
class APRInterface
{
   public:
      static void destroyInstance();
      static APRInterface &getInstance();
      static APRInterface &getInstance(int *argc, const char *const **argv);
      ~APRInterface();
      static void func_CheckAPRError(apr_status_t status, const char *fpretty, int line);
      apr_pool_t *getGlobalPool();
      int wasSuccessfullyInitialised();
   private:
      APRInterface();
      APRInterface(int *argc, const char *const **argv);
      void APRInit(int inited);
      /** Private pointer to hold the singleton instance. */
      static APRInterface *apr_iface_singleton;
      /** A flag to record whether the library has been initialised
       * correctly. */
      int isinit;
      /** A global memory pool, which is initialised on start up */
      apr_pool_t *mp;
};

#define CheckAPRError(status) APRInterface::func_CheckAPRError(status, __PRETTY_FUNCTION__, __LINE__)

#endif
